


import {
  get,
  post,
  put,
} from "./base_service"


/**
 * 佳宝首页相关接口
 *
 * allen  2023-12-19
 */

/**
 *
 * 获取我的积分详情
 */
const myScoreDetail = () => {
  return new Promise((resolve, reject) => {
    get("/api/front/integral/user").then((data) => {
      if (data.code == 200) {
        resolve(data)
      } else {
        reject(data.message)
      }
    }).catch((e) => {
      reject(e.message)
    })
  })
}



/**
 *
 * 获取我的积分详情
 */
const scoreChangeList = (page, limit = 10) => {
  return new Promise((resolve, reject) => {
    get("/api/front/integral/list?page=" + page + "&limit=" + limit).then((data) => {
      if (data.code == 200) {
        resolve(data)
      } else {
        reject(data.message)
      }
    }).catch((e) => {
      reject(e.message)
    })
  })
}


/**
 *
 * 我的经验记录
 */
const experienceChangeList = (page, limit = 10) => {
  return new Promise((resolve, reject) => {
    get("/api/front/user/proExpList?page=" + page + "&limit=" + limit).then((data) => {
      if (data.code == 200) {
        resolve(data)
      } else {
        reject(data.message)
      }
    }).catch((e) => {
      reject(e.message)
    })
  })
}

/**
 *
 * 获取我的提现记录
 */
const extractRecord = (page, limit = 10) => {
  return new Promise((resolve, reject) => {
    get("/api/front/extract/record?page=" + page + "&limit=" + limit).then((data) => {
      if (data.code == 200) {
        resolve(data)
      } else {
        reject(data.message)
      }
    }).catch((e) => {
      reject(e.message)
    })
  })
}

/**
 *
 * 获取我的余额
 */
const myBalanceDetail = () => {
  return new Promise((resolve, reject) => {
    get("/api/front/user/balance").then((data) => {
      if (data.code == 200) {
        resolve(data)
      } else {
        reject(data.message)
      }
    }).catch((e) => {
      reject(e.message)
    })
  })
}

/**
 *
 * 获取余额list
 */
const myBalanceList = (page, type, limit = 20) => {
  return new Promise((resolve, reject) => {
    get("/api/front/recharge/bill/record?page=" + page + "&type=" + type + "&limit=" + limit).then((data) => {
      if (data.code == 200) {
        resolve(data)
      } else {
        reject(data.message)
      }
    }).catch((e) => {
      reject(e.message)
    })
  })
}




module.exports = {
  myScoreDetail,
  scoreChangeList,
  myBalanceDetail,
  myBalanceList,
  extractRecord,
  experienceChangeList
}

